<%@page pageEncoding="UTF-8" contentType="text/html; UTF-8" isELIgnored="false" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户信息管理系统</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            --primary: #f7da4a;
            --secondary: #3f37c9;
            --success: #4cc9f0;
            --light: #f8f9fa;
            --dark: #212529;
            --danger: #f72585;
            --gray: #6c757d;
            --border: #dee2e6;
            --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
        }

        body {
            background: linear-gradient(135deg, #fae18e 0%, #e4edf5 100%);
            min-height: 100vh;
            padding: 20px;
            color: var(--dark);
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
        }

        header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 30px;
            padding: 20px 0;
            border-bottom: 1px solid var(--border);
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .logo i {
            font-size: 2.2rem;
            color: var(--primary);
        }

        .logo h1 {
            font-size: 1.8rem;
            font-weight: 700;
            color: var(--primary);
        }

        .back-btn {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 10px 20px;
            background: var(--primary);
            color: white;
            text-decoration: none;
            border-radius: 8px;
            font-weight: 500;
            transition: all 0.3s ease;
            box-shadow: var(--shadow);
        }

        .back-btn:hover {
            background: var(--secondary);
            transform: translateY(-2px);
            box-shadow: 0 6px 15px rgba(67, 97, 238, 0.4);
        }

        .card {
            background: white;
            border-radius: 16px;
            box-shadow: var(--shadow);
            overflow: hidden;
            margin-bottom: 30px;
        }

        .card-header {
            padding: 20px 30px;
            background: linear-gradient(to right, var(--primary), var(--secondary));
            color: white;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .card-header h2 {
            font-size: 1.5rem;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .card-body {
            padding: 30px;
            overflow-x: auto;
        }

        .user-table {
            width: 100%;
            border-collapse: collapse;
            min-width: 600px;
        }

        .user-table th {
            background-color: #f1f5ff;
            color: var(--primary);
            text-align: left;
            padding: 16px 20px;
            font-weight: 600;
            border-bottom: 2px solid var(--border);
        }

        .user-table td {
            padding: 16px 20px;
            border-bottom: 1px solid var(--border);
            transition: background-color 0.2s;
        }

        .user-table tr:not(:last-child) td {
            border-bottom: 1px solid var(--border);
        }

        .user-table tr:hover td {
            background-color: #f8faff;
        }

        .user-id {
            color: var(--gray);
            font-weight: 500;
        }

        .user-account {
            font-weight: 600;
            color: var(--dark);
        }

        .action-link {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 8px 16px;
            background-color: #fee8ec;
            color: var(--danger);
            text-decoration: none;
            border-radius: 6px;
            font-weight: 500;
            transition: all 0.3s ease;
        }

        .action-link:hover {
            background-color: var(--danger);
            color: white;
            transform: translateY(-2px);
            box-shadow: 0 4px 10px rgba(247, 37, 133, 0.3);
        }

        .stats-container {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-bottom: 30px;
        }

        .stat-card {
            background: white;
            border-radius: 16px;
            padding: 25px;
            box-shadow: var(--shadow);
            display: flex;
            align-items: center;
            gap: 20px;
            transition: transform 0.3s ease;
        }

        .stat-card:hover {
            transform: translateY(-5px);
        }

        .stat-icon {
            width: 60px;
            height: 60px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.8rem;
        }

        .stat-icon.primary {
            background: rgba(67, 97, 238, 0.1);
            color: var(--primary);
        }


        .stat-info h3 {
            font-size: 1.8rem;
            font-weight: 700;
            margin-bottom: 5px;
        }

        .stat-info p {
            color: var(--gray);
            font-weight: 500;
        }

        footer {
            text-align: center;
            padding: 20px;
            color: var(--gray);
            margin-top: 40px;
            border-top: 1px solid var(--border);
        }

        @media (max-width: 768px) {
            .card-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 15px;
            }

            .logo h1 {
                font-size: 1.5rem;
            }

            .back-btn {
                padding: 8px 15px;
                font-size: 0.9rem;
            }

            .card-body {
                padding: 20px 15px;
            }
        }
    </style>
</head>
<body>
<div class="container">
    <header>
        <div class="logo">
            <i class="fas fa-users-cog"></i>
            <h1>用户信息管理系统</h1>
        </div>
        <a href="backend" class="back-btn">
            <i class="fas fa-arrow-left"></i>
            返回管理后台
        </a>
    </header>

    <div class="stats-container">
        <div class="stat-card">
            <div class="stat-icon primary">
                <i class="fas fa-user-friends"></i>
            </div>
            <div class="stat-info">
                <h3>${users.size()}</h3>
                <p>注册用户总数</p>
            </div>
        </div>
    </div>

    <div class="card">
        <div class="card-header">
            <h2><i class="fas fa-list"></i> 用户信息列表</h2>
        </div>
        <div class="card-body">
            <table class="user-table">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>用户名</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${users}" var="user">
                    <tr>
                        <td><span class="user-id">#${user.id}</span></td>
                        <td><span class="user-account">${user.account}</span></td>
                        <td>
                            <a href="${pageContext.request.contextPath}/deleteUser?id=${user.id}" class="action-link">
                                <i class="fas fa-user-minus"></i>
                                注销账户
                            </a>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </div>

</div>

<script>
    // 添加简单的交互效果
    document.addEventListener('DOMContentLoaded', function() {
        const actionLinks = document.querySelectorAll('.action-link');

        actionLinks.forEach(link => {
            link.addEventListener('click', function(e) {
                if(!confirm('确定要注销该用户吗？此操作不可撤销！')) {
                    e.preventDefault();
                }
            });
        });

        // 添加表格行点击效果
        const tableRows = document.querySelectorAll('.user-table tbody tr');
        tableRows.forEach(row => {
            row.addEventListener('click', function() {
                this.classList.toggle('selected');
            });
        });
    });
</script>
</body>
</html>